package darknet.application.chat.impl.net.message;

import darknet.core.impl.net.AbstractMessage;
import darknet.core.spec.net.MessageHeader;
import darknet.core.spec.net.Node;

/**
 * Broadcast version of a channel message.
 *
 * @author yoyo
 */
public class BroadcastExitChannelMessage extends AbstractMessage {

    // TODO use a decorator for broadcasted message.

    /** The channel name */
    private String channelName = null;

    /** Exiter */
    private Node exiter = null;

    /**
     * Initialize a new broadcast exit channel message.
     * 
     * @param header
     * @param from
     * @param to
     * @param channelName
     * @param exiter
     */
    public BroadcastExitChannelMessage(MessageHeader header, Node from, Node to,
            String channelName, Node exiter) {

        super(header, from, to);

        if (channelName == null || channelName.length() == 0) {
	    throw new IllegalArgumentException("channelName is invalid");
	}
	this.channelName = channelName;

        if (exiter == null) {
            throw new IllegalArgumentException("exiter is invalid (null)");
        }
        this.exiter = exiter;
    }

    /**
     * Get the channel name.
     * @return
     */
    public String getChannelName() {
	return channelName;
    }

    /**
     * Get the exiter.
     * 
     * @return
     */
    public Node getExiter() {
        return exiter;
    }
}
